package cn.szzsi.model.mall;

import cn.szzsi.common.util.CommonUtil;
import com.jfinal.kit.StrKit;
import org.apache.commons.codec.digest.DigestUtils;

import java.util.Date;

public class MemberService {
    public static final MemberService service = new MemberService();

    /**
     * 更新会员信息
     */
    public void updateMember(String phone){
        Member member=Member.dao.getByPhone(phone);
        if(member==null){
            member=new Member().use(CommonUtil.ZSHOP_MALL).dao();
            member.setId(StrKit.getRandomUUID());
            member.setUsername(phone);
            member.setPassword(DigestUtils.md5Hex(phone));
            member.setCreateDate(new Date());
            member.save();
        }
    }
}
